package cc.toprank.syncdatatask.component;

import cc.toprank.syncdatatask.canal.CanalClient;
import org.apache.log4j.Logger;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component("initBeanCompent")
public class InitBeanComponent {
	
	private Logger logger = Logger.getLogger(InitBeanComponent.class);

	@Autowired
	CanalClient clusterCanalClient;

	@Autowired
    RabbitTemplate rabbitTemplate;

	@PostConstruct
	public void init() {
		clusterCanalClient.startCanal(rabbitTemplate);
	    logger.debug("服务端初始化canal和消息监听器成功");
	}
}
